import type { MultipleConditionSearchSchema } from '@/components/multiple-condition-search'

export default function useConfig() {
  const searchSchema = computed<MultipleConditionSearchSchema>(() => {
    return {
      placeholder: '默认按照集群名称搜索',
      widgets: [
        {
          label: '集群名称',
          field: 'name_keyword',
          maxLength: 30,
        },
        {
          label: '域名',
          field: 'domain_keyword',
        },
      ],
    }
  })

  const tableColumns = buildColumns([
    {
      title: '账户邮箱',
      dataIndex: 'email',
    },
    {
      title: '账户品牌',
      width: 200,
      dataIndex: 'brand',
      slotName: 'brand',
    },
    {
      title: '密钥算法',
      width: 200,
      dataIndex: 'algorithm',
      slotName: 'algorithm',
    },
    {
      title: 'URL',
      dataIndex: 'url',
    },
    {
      title: '创建时间 ',
      dataIndex: 'created_at',
      format: 'date-time',
      sortable: sortableSettings,
    },
    {
      title: '操作',
      fixed: 'right',
      slotName: 'actions',
      width: 56,
      cellClass: 'actions-cell',
    },
  ])

  return {
    searchSchema,
    tableColumns,
  }
}
